Hệ thống quản lý phòng khám trực tuyến bằng PHP
1 <?php if(!isset($Translation)) die('No direct access allowed.'); ?>
2 <?php $current_table = 'events'; ?>
3 <?php
4 $cleaner = new CI_Input();
5 $cleaner->charset = datalist_db_encoding;
6 ?>
7 <script>
8 <?php echo $current_table; ?>GetChildrenRecordsList = function(command){
9 var param = {
10 ChildTable: "<?php echo $parameters['ChildTable']; ?>",
11 ChildLookupField: "<?php echo $parameters['ChildLookupField']; ?>",
12 SelectedID: "<?php echo addslashes($parameters['SelectedID']); ?>",
13 Page: <?php echo addslashes($parameters['Page']); ?>,
14 SortBy: <?php echo ($parameters['SortBy'] === false ? '""' : $parameters['SortBy']); ?>,
15 SortDirection: '<?php echo $parameters['SortDirection']; ?>',
16 AutoClose: <?php echo ($config['auto-close'] ? 'true' : 'false'); ?>
17 };
18 var panelID = "panel_<?php echo "{$parameters['ChildTable']}-{$parameters['ChildLookupField']}"; ?>";
19 var mbWidth = window.innerWidth * 0.9;
20 var mbHeight = window.innerHeight * 0.8;
21 if(mbWidth > 1000){ mbWidth = 1000; }
22 if(mbHeight > 800){ mbHeight = 800; }
23
24 switch(command.Verb){
25 case 'sort': /* order by given field index in 'SortBy' */
26 post("parent-children.php", {
27 ChildTable: param.ChildTable,
28 ChildLookupField: param.ChildLookupField,
29 SelectedID: param.SelectedID,
30 Page: param.Page,
31 SortBy: command.SortBy,
32 SortDirection: command.SortDirection,
33 Operation: 'get-records-printable'
34 }, panelID, undefined, 'pc-loading');
35 break;
36 case 'page': /* next or previous page as provided by 'Page' */
37 if(command.Page.toLowerCase() == 'next'){ command.Page = param.Page + 1; }
38 else if(command.Page.toLowerCase() == 'previous'){ command.Page = param.Page - 1; }
39
40 if(command.Page < 1 || command.Page > <?php echo ceil($totalMatches / $config['records-per-page']); ?>){ return; }
41 post("parent-children.php", {
42 ChildTable: param.ChildTable,
43 ChildLookupField: param.ChildLookupField,
44 SelectedID: param.SelectedID,
45 Page: command.Page,
46 SortBy: param.SortBy,
47 SortDirection: param.SortDirection,
48 Operation: 'get-records-printable'
49 }, panelID, undefined, 'pc-loading');
50 break;
51 case 'reload': /* just a way of refreshing children, retaining sorting and pagination & without reloading the whole page */
52 post("parent-children.php", {
53 ChildTable: param.ChildTable,
54 ChildLookupField: param.ChildLookupField,
55 SelectedID: param.SelectedID,
56 Page: param.Page,
57 SortBy: param.SortBy,
58 SortDirection: param.SortDirection,
59 Operation: 'get-records-printable'
60 }, panelID, undefined, 'pc-loading');
61 break;
62 }
63 };
64 </script>
65
66 <div class="row">
67 <div class="col-xs-12 col-md-12">
68
69 <div class="page-header"><h1>
70 <?php echo ($config['table-icon'] ? '<img src="' . $config['table-icon'] . '">' : ''); ?>
71 <?php echo $config['tab-label']; ?>
72 </h1></div>
73
74
75 <div class="table-responsive">
76 <table class="table table-striped table-hover table-condensed table-bordered">
77 <thead>
78 <tr>
79 <?php if(is_array($config['display-fields'])) foreach($config['display-fields'] as $fieldIndex => $fieldLabel){ ?>
80 <th
81 <?php if($config['sortable-fields'][$fieldIndex]){ ?>
82 onclick="<?php echo $current_table; ?>GetChildrenRecordsList({
83 Verb: 'sort',
84 SortBy: <?php echo $fieldIndex; ?>,
85 SortDirection: '<?php echo ($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'asc' ? 'desc' : 'asc'); ?>'
86 });"
87 style="cursor: pointer;"
88 <?php } ?>
89 class="<?php echo "{$current_table}-{$config['display-field-names'][$fieldIndex]}"; ?>">
90 <?php echo $fieldLabel; ?>
91 <?php if($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'desc'){ ?>
92 <i class="glyphicon glyphicon-sort-by-attributes-alt text-warning"></i>
93 <?php }elseif($parameters['SortBy'] == $fieldIndex && $parameters['SortDirection'] == 'asc'){ ?>
94 <i class="glyphicon glyphicon-sort-by-attributes text-warning"></i>
95 <?php } ?>
96 </th>
97 <?php } ?>
98 </tr>
99 </thead>
100 <tbody>
101 <?php if(is_array($records)) foreach($records as $pkValue => $record){ ?>
102 <tr>
103 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][1]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][1]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[1]); ?></td>
104 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][2]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[2]); ?></td>
105 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][3]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][3]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[3]); ?></td>
106 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][4]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][4]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[4]); ?></td>
107 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][5]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][5]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[5]); ?></td>
108 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][6]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][6]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[6]); ?></td>
109 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][7]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][7]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[7]); ?></td>
110 <td class="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][8]}"; ?>" id="<?php echo "{$parameters['ChildTable']}-{$config['display-field-names'][8]}-" . html_attr($record[$config['child-primary-key-index']]); ?>"><?php echo $cleaner->xss_clean($record[8]); ?></td>
111 </tr>
112 <?php } ?>
113 </tbody>
114 <tfoot>
115 <tr>
116 <td colspan="<?php echo count($config['display-fields']); ?>">
117 <?php if($totalMatches){ ?>
118 <?php if($config['show-page-progress']){ ?>
119 <span style="margin: 10px;">
120 <?php $firstRecord = ($parameters['Page'] - 1) * $config['records-per-page'] + 1; ?>
121 <?php echo str_replace(array('<FirstRecord>', '<LastRecord>', '<RecordCount>'), array($firstRecord, $firstRecord + count($records) - 1, $totalMatches), $Translation['records x to y of z']); ?>
122 </span>
123 <?php } ?>
124 <?php }else{ ?>
125 <span class="text-danger" style="margin: 10px;"><?php echo $Translation['No matches found!']; ?></span>
126 <?php } ?>
127 </td>
128 </tr>
129 </tfoot>
130 </table>
131 </div>
132 <?php if($totalMatches){ ?>
133 <div class="row hidden-print">
134 <div class="col-xs-12">
135 <button type="button" class="btn btn-default" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'page', Page: 'previous' });"><i class="glyphicon glyphicon-chevron-left"></i></button>
136 <button type="button" class="btn btn-default" onclick="<?php echo $current_table; ?>GetChildrenRecordsList({ Verb: 'page', Page: 'next' });"><i class="glyphicon glyphicon-chevron-right"></i></button>
137 </div>
138 </div>
139 <?php } ?>
140 </div>
141 </div>
142 <script>$j(function(){ $j('img[src^="thumbnail.php?i=&"').parent().hide(); });</script>